package com.baway.biliclitent;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

/**
 * 1.类的用途：启动页
 * 2.渠刚
 * 3.@date
 * 4.用途:
 */
public class StartActivity extends AppCompatActivity{
    private int i = 3;
    private ImageView mImage;
    private Handler handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            if(msg.what == 0){
                Intent it = new Intent(StartActivity.this,MainActivity.class);
                startActivity(it);
            }
        }
    };
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.open_layout);
        mImage = (ImageView) findViewById(R.id.open_image);

        //三面进入主界面
        new Thread(new Runnable() {
            @Override
            public void run() {
                while(i>0){
                    i--;
                    if(i==0){
                        handler.sendEmptyMessage(0);
                        break;
                    }
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        handler.removeCallbacksAndMessages(null);
    }
}
